<template>
  <div>
    <input type="text" v-model="idcard">
  </div>
  <div>
    <img :src="imgsrc" class="avatar">
  </div>
</template>
<script lang='ts' setup>
import {ref,watch} from 'vue'
let idcard=ref<string>("")
let imgsrc=ref<string>("https://img0.baidu.com/it/u=1821253856,3774998416&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500")
watch(idcard,(arg)=>{
  if(arg.length==18){
    if(+arg[16]%2==0){
      imgsrc.value="https://t7.baidu.com/it/u=854292069,547702128&fm=193&f=GIF"
    }else{
      imgsrc.value="https://t8.baidu.com/it/u=556383705,1003216174&fm=193"
    }
  }
  
  
  
})
</script>
<style lang='scss' scoped>
.avatar{
  width: 100px;
  margin: 20px;
}
</style>